public class Solution1 {
    //反转链表
    public ListNode reverseList(ListNode head) {
        if(head == null) return null;
        ListNode cur = head.next;
        ListNode curN = null;
        head.next = null;
        while(cur != null) {
            curN = cur.next;
            cur.next = head;
            head = cur;
            cur = curN;
        }
        return head;
    }
}
